

import Menu from "./Menu"
import { BaseTable } from "@xuekl/cli-core/builder"
import { Operation } from "@xuekl/cli-core/helper"
import { TableColumn, TableOperation } from "@xuekl/cli-core/types"

export default class MenuTable extends BaseTable<Menu> implements Operation {
    operation: TableOperation = {
        label: '操作',
        width: 100
    }
    columns: TableColumn<Menu>[] = [
        {
            prop: 'menuName',
            label: '菜单名称'
        },
        {
            prop: 'orderNum',
            label: '显示排序'
        },
        {
            prop: 'path',
            label: '路由地址'
        },
        {
            prop: 'component',
            label: '组件路径'
        },
        {
            prop: 'perms',
            label: '权限字符'
        },
        {
            prop: 'status',
            label: '菜单状态',
            tags: [{ value: '0', type: 'primary' }, { value: '1', type: 'danger' }],
            dict: 'sys_normal_disable'
        },
    ]

    constructor() {
        super()
        this.element.rowKey = 'menuId'
        this.element.treeProps = {
            hasChildren: 'hasChildren',
            children: 'children'
        }
    }
}